package com.zhj.helloframework.util;

import java.util.Collection;
import java.util.Map;

/**
 * @Author: zhj
 * @Description: 参数校验类
 * @Date: 2021/9/29 11:11
 * @Version: 1.0
 */
public class ValidationUtil {
    /**
     * String是否为null或者""
     * @param obj
     * @return
     */
    public static boolean isEmpty(String obj) {
        return obj == null || "".equals(obj);
    }

    /**
     * java中的数组是否为null或者size=0
     * @param obj
     * @return
     */
    public static boolean isEmpty(Object[] obj) {
        return obj == null || obj.length == 0;
    }

    /**
     * 判断Collection是否为null或者size=0
     * @param obj
     * @return
     */
    public static boolean isEmpty(Collection<?> obj) {
        return obj == null || obj.isEmpty();
    }

    /**
     * Map是否为null或者size=0
     * @param obj
     * @return
     */
    public static boolean isEmpty(Map<?,?> obj) {
        return obj == null || obj.isEmpty();
    }
}
